<?php

namespace apiend\modules\passport\controllers;

use Yii;
use apiend\components\Controller;
use apiend\modules\passport\models\CaptchaValidateForm;

/**
 * 后端路由
 * @author emhome <emhome@163.com>
 * @since 2.0
 */
class RouterController extends Controller {

    /**
     * @inheritdoc
     */
    protected function verbs() {
        return [
            'index' => ['GET'],
        ];
    }

    /**
     * @inheritdoc
     */
    protected function rules() {
        return [
            [
                'allow' => true,
                'roles' => ['@'],
            ],
        ];
    }

    /**
     * 帐号信息
     * @return mixed
     */
    public function actionIndex() {
        $query = \apiend\models\User::find();
        return new \yii\data\ActiveDataProvider([
            'query' => $query,
        ]);
        
        return [
            [
                "parent_id" => 0,
                "menu_name" => "系统管理",
                "icon" => "fa fa-adjust",
                "menu_type" => "M",
                "menu_id" => 1,
                "url" => "#",
                "children" => [
                    [
                        "parent_id" => 1,
                        "menu_name" => "Export Excel",
                        "menu_type" => "C",
                        "icon" => "#",
                        "menu_id" => 4,
                        "url" => "/excel/export-excel"
                    ],
                    [
                        "parent_id" => 1,
                        "menu_name" => "通讯录管理",
                        "menu_type" => "C",
                        "icon" => "#",
                        "menu_id" => 73,
                        "url" => "/excel/select-excel"
                    ]
                ],
            ],
        ];
    }

}
